﻿using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using Common;


public class AvatarClothes
{
    public AvatarHandle Handle;
    public Renderer Render;
    public string Para = string.Empty;
    public AvatarClothes(AvatarHandle handle)
    {
        Handle = handle;
        Transform renderObj = Handle.Root.transform.Find("objObject04");
        Render = renderObj.renderer;
    }
    public void FixedUpdate()
    {
        if (SetAlpha)
        {
            alpha -= .05f;
            if (alpha < minAlpha)
            {
                alpha = minAlpha;
            }
        }
        else
        {
            alpha += .05f;
            if (alpha > 1)
            {
                alpha = 1;
            }
        }
        if (alpha != currentColor.a)
        {
            currentColor.a = alpha;
            Render.material.SetColor("_Color", currentColor);
        }
    }
    private Color currentColor = new Color(1, 1, 1, 1);
    private float alpha = 1.0f;
    private const float minAlpha = 0.3f;
    public bool SetAlpha = false;
}

